<?php 
/*
Template Name: Služby
*/
global $post;
$background = get_the_post_thumbnail_url();
//fallback
if ( empty( $background ) ) { 
	$background = get_field('default_image', 'options')['url'];
  }
$slider = new SlickSlider; 
$video_url = get_field('video_response');
$choise = get_field('pravy_sloupec_sluzeb');
get_header();

?>
<section class="wrapper" style="background: #fff url(<?php if ( !empty( $background ) ) echo $background; ?>) no-repeat; background-size: 100% auto; background-size: cover;">
<div class="container container-services">
	<div class="col-sm-12">

		<div class="page-container">

			<div class="row">

				<div class="col-md-6">

					<header> 
						<h1><?php the_title(); ?></h1>
					</header>
					<?php get_template_part('inc/breadcrumbs'); ?>
					<div class="entry-content">
						<?php the_content(); ?>
					</div>
					
				</div>

				<div class="col-md-6">
						<?php 
						
						if( isset( $choise ) && in_array('galerie', $choise) ) { 
							$slider->gallery_with_main_image( $post->ID ); 
						} 
						//panorama 
						
						if( isset( $choise ) && in_array('panorama', $choise) ){ ?>
							<?php if( have_rows('panorama_360') ): ?>
								
								<?php while( have_rows('panorama_360') ): the_row(); 

									// vars
									$title = get_sub_field('panorama_title');
									$image = get_sub_field('panorama_background');
									$shordcode = get_sub_field('panorama_shordcode');
									?>
									<?php if (!empty($title)) { ?>
										<h3><?php echo $title; ?></h3>
									<?php } ?>
									<div class="panom360" style="background: #fff url(<?php echo $image['url']; ?>) no-repeat; background-size: 100% auto; background-size: cover;">
										<?php echo do_shortcode($shordcode); ?>
									</div>

								<?php endwhile; 
							
							endif; 
						
						} 
						
						if( isset( $choise ) &&in_array('video', $choise) ){ ?>
							<div class="video-box">
								<?php video_res_wedesin($video_url); ?>
							</div>
						<?php } 
						
						if( isset( $choise ) && in_array('iframe', $choise) ){ 
							
							if( have_rows('models_iframe') ): ?>
								
								<?php while( have_rows('models_iframe') ): the_row(); 

									// vars
									$title = get_sub_field('iframe_title');
									$code = get_sub_field('iframe_code');
									?>
									<?php if (!empty($title)) { ?>
										<h3><?php echo $title; ?></h3>
									<?php } ?>
									<div class="iframe-box">
										<?php echo $code; ?>
									</div>


								<?php endwhile; ?>

							<?php endif; ?>
							<?php } ?>

							<?php /*
							<h3 class="green"> Zaujali vás naše služby? </h3>
							<h3> Neváhejte nás kontaktovat </h3>*/ ?>
					
					</div>
	
			</div>

		</div>
	</div>
</div>
   
<?php get_template_part( 'inc/footer', 'contact' ); ?>
</section>

<?php get_footer('fp');?>